package com.example.mobile2021606159yhf0330;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    private EditText editTextMainAccount;
    private EditText editTextMainPsn;
    private Button btnMainLogin;
    private Button btnMainReset;
    private TextView textView;
    private EditText editTextTextPassword;
    private EditText editTextTextPassword2;
    private Button button;
    private Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //获取输入内容
                String account = editTextMainAccount.getText().toString();
                String password = editTextMainPsn.getText().toString();


                if (account.length() == 0) {
                    Log.i("登录", "请输入用户名");

                } else if (password.length() == 0) {
                    Log.i("登录", "请输入密码");
                } else {

                    if (account.equals("admin") & password.equals("123456")) {
                        Log.i("登录", "登录成功");

                    } else {
                        Log.i("登录", "登陆失败");
                    }
                    editTextMainAccount.setText(null);
                    editTextMainPsn.setText(null);
                }
            }
        });
    }
            private void initView() {
                textView = (TextView) findViewById(R.id.textView);
                editTextTextPassword = (EditText) findViewById(R.id.editTextTextPassword);
                editTextTextPassword2 = (EditText) findViewById(R.id.editTextTextPassword2);
                button = (Button) findViewById(R.id.button);
                button2 = (Button) findViewById(R.id.button2);
            }

        }
